/*
 * Plant.h
 *
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses 
 */

#ifndef PLANT_H_
#define PLANT_H_

#include "Spawner.h"
#include "LivingObject.h"

// Modela las plantas

class Plant: virtual public LivingObject, virtual public Spawner {
private:
    int shoot_frequency;
    int tics;
    int facing;

public:
    Plant(int x, int y, int shoot_frequency, int facing);
    Plant(int id, int x, int y, int shoot_frequency, int facing);
    virtual void receiveDamage(int damage, MapObject* from = 0);
    virtual bool isDestroyed();
    // La acción de "vivir" de la planta es contar el tiempo que pasó desde el
    // último disparo
    virtual void live(Map& map);
    // Devuelve true si puede disparar
    virtual bool canSpawn(Map& map);
    // Devuelve una nueva MovingBomb
    virtual LivingObject* spawn();
    // Las plantas nunca se agotan, siguen disparando siempre
    virtual bool isDepleted();
    Plant* clone();
    ModelObject getRepresentation();
    int getSpawningX();
    int getSpawningY();
    int getShootFrequency();
    int getFacing();

private:
    void init();
};

#endif /* PLANT_H_ */
